﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="Core"
                   namespace="Core.Model">
  <class name="Empresa" table="EMPRESA">
    <id name="Id" column="EMPRESA_ID">
      <generator class="native">
        <param name="sequence">GEN_ID_EMPRESA</param>
      </generator>
    </id>
    <property name="DataCadastro" column="DATA_CADASTRO" not-null="true" />
    <property name="Nome" column="NOME" length="100" not-null="true" />
    <property name="RazaoSocial" column="RAZAO_SOCIAL" length="100" not-null="true" />
    <property name="NumCpnj" column="NUM_CNPJ" length="30" not-null="true" />
    <property name="NumInscrEstadual" column="NUM_INSCR_ESTADUAL" length="30" />
    <property name="NumInscrMunicipal" column="NUM_INSCR_MUNICIPAL" length="30" />
    <property name="Endereco" column="ENDERECO" length="80" />
    <property name="NumEndereco" column="NUM_ENDERECO" />
    <property name="NumCep" column="NUM_CEP" length="10" />
    <property name="Bairro" column="BAIRRO" length="60" />
    <property name="Complemento" column="COMPLEMENTO" length="40" />
    <property name="NumDdd" column="NUM_DDD" length="2" />
    <property name="NumTelefone" column="NUM_TELEFONE" length="8" />
    <property name="NomeContato" column="NOME_CONTATO" length="60" />
    <property name="EnderecoSite" column="ENDERECO_SITE" length="150" />
    <many-to-one name="CidadeEntity" column="CIDADE_ID" cascade="save-update" not-null="true" />
    <many-to-one name="EstadoEntity" column="ESTADO_ID" cascade="save-update" not-null="true" />
    <bag name="Loja" inverse="true" lazy="true" cascade="delete">
      <key column="EMPRESA_ID" />
      <one-to-many class="Core.Model.Loja,Core" />
    </bag>
    <bag name="GrupoFerramenta" inverse="true" lazy="true" cascade="delete">
      <key column="EMPRESA_ID" />
      <one-to-many class="Core.Model.GrupoFerramenta,Core" />
    </bag>
    <bag name="Ferramenta" inverse="true" lazy="true" cascade="delete">
      <key column="EMPRESA_ID" />
      <one-to-many class="Core.Model.Ferramenta,Core" />
    </bag>
  </class>
</hibernate-mapping>